<?php include "inc/header.inc"; ?>

<?php

if(isset($_REQUEST['Submit']))
{

	if(!isset($_REQUEST['qstType'])){ $qstType="9"; } else { $qstType = $_REQUEST['qstType']; }
	if(!isset($_REQUEST['qst1'])){ $qst1="9"; } else { $qst1 = $_REQUEST['qst1']; }
	if(!isset($_REQUEST['qst2'])){ $qst2="9"; } else { $qst2 = $_REQUEST['qst2']; }
	$qst2_est = limpa_caracter($_REQUEST['qst2_est']);
	if(!isset($_REQUEST['qst3'])){ $qst3="9"; } else { $qst3 = $_REQUEST['qst3']; }
	if(!isset($_REQUEST['qst4'])){ $qst4="9"; } else { $qst4 = $_REQUEST['qst4']; }
	if(!isset($_REQUEST['qst5'])){ $qst5="9"; } else { $qst5 = $_REQUEST['qst5']; }

	$qst6 = limpa_caracter($_REQUEST['qst6']);

	if(!isset($_REQUEST['qst7'])){ $qst7="9"; } else { $qst7 = $_REQUEST['qst7']; }

	$qst8 = limpa_caracter($_REQUEST['qst8']);

	if(!isset($_REQUEST['qst9'])){ $qst9="9"; } else { $qst9 = $_REQUEST['qst9']; }

	$qst10 = limpa_caracter($_REQUEST['qst10']);

	if(!isset($_REQUEST['qst11'])){ $qst11="9"; } else { $qst11 = $_REQUEST['qst11']; }

	$qst12 = limpa_caracter($_REQUEST['qst12']);


	if(!isset($_REQUEST['qst13_A'])){ $qst13_A="9"; } else { $qst13_A = $_REQUEST['qst13_A']; }
	if(!isset($_REQUEST['qst13_B'])){ $qst13_B="9"; } else { $qst13_B = $_REQUEST['qst13_B']; }
	if(!isset($_REQUEST['qst13_C'])){ $qst13_C="9"; } else { $qst13_C = $_REQUEST['qst13_C']; }


	if(!isset($_REQUEST['qst14'])){ $qst14="9"; } else { $qst14 = $_REQUEST['qst14']; }

	$qst14_name = limpa_caracter($_REQUEST['qst14_name']);
	$qst14_phone = limpa_caracter($_REQUEST['qst14_phone']);
	$qst14_email = limpa_caracter($_REQUEST['qst14_email']);

	if(!isset($_REQUEST['qst15'])){ $qst15="9"; } else { $qst15 = $_REQUEST['qst15']; }

	$strSql = "insert into db_survey_questionnaire ";
	$strSql .= "(qstType, qst1, qst2, qst2_est,	qst3, qst4, qst5, qst6, qst7, qst8,	qst9, qst10, ";
	$strSql .= "qst11, qst12, qst13_A, qst13_B,	qst13_C, qst14,	qst14_name,	qst14_phone, qst14_email, qst15, dat_answer)";
	$strSql .= " values ($qstType, $qst1, $qst2, '$qst2_est', $qst3, $qst4, $qst5, '$qst6', $qst7,	'$qst8', $qst9, '$qst10', ";
	$strSql .= " $qst11, '$qst12', $qst13_A, $qst13_B,	$qst13_C, $qst14, '$qst14_name', '$qst14_phone', '$qst14_email', $qst15, now())";

	//echo $strSql;
	$rs = execQuery($strSql);

	if($rs)
	{
		echo "<script language='javascript'>alert('Register has been inserted!');</script>";
	}
	else
	{
		echo "<script language='javascript'>alert('Error: Register has not been inserted!\\nPlease, check your data and Submit the form again.');history.go(-1);</script>";
	}




}
?>



<div id="designologuefp">



<h3>Survey Questionnaire Prototype</h3>
<form action="" id="surveyform" method="post"
	onsubmit="return checkFill();">
<ul>

	<li><strong>Questionnaire type:</strong><br />
	<input name="qstType" type="radio" value="1" /> 1-Structure<br />
	<input name="qstType" type="radio" value="2" /> 2-Treatment Director
	Climate<br />
	<input name="qstType" type="radio" value="3" /> 3-Treatment Staff
	Climate<br />
	<input name="qstType" type="radio" value="4" /> 4-Non-treatment Staff
	Climate<br />
	<input name="qstType" type="radio" value="9" /> 9-No answer<br />

	</li>

	<li><strong>1 - Name of your CBS:</strong><br />
	<input name="qst1" type="radio" value="1" /> 1-Norfolk<br />
	<input name="qst1" type="radio" value="2" /> 2-Cumberland Mountain<br />
	<input name="qst1" type="radio" value="9" /> 9-No answer<br />

	</li>


	<li><strong>2 - Approximately how long did it take you to complete the
	survey(s)?</strong><br />
	<input name="qst2" type="radio" value="1" /> 1-10 to 15 minutes<br />
	<input name="qst2" type="radio" value="2" /> 2-15 to 20 minutes<br />
	<input name="qst2" type="radio" value="3" /> 3-20 to 30 minutes<br />
	<input name="qst2" type="radio" value="4" /> 4-30 to 40 minutes<br />
	<input name="qst2" type="radio" value="5" /> 5-40 to 50 minutes<br />
	<input name="qst2" type="radio" value="6" /> 6-50 minutes to 1 hour<br />
	<input name="qst2" type="radio" value="7" /> 7-More than 1 hour (if so,
	estimate how long <input name="qst2_est" type="text" size="5"
		maxlength="5" />) <br />
	<input name="qst2" type="radio" value="9" /> 9-No answer<br />

	</li>


	<li><strong>3 - In your opinion, was the survey:</strong><br />
	<input name="qst3" type="radio" value="1" /> 1-Boring<br />
	<input name="qst3" type="radio" value="2" /> 2-Somewhat interesting<br />
	<input name="qst3" type="radio" value="3" /> 3-Very interesting<br />
	<input name="qst3" type="radio" value="9" /> 9-No answer<br />

	</li>


	<li><strong>4 - In your opinion, was the survey:</strong><br />
	<input name="qst4" type="radio" value="1" /> 1-Too long<br />
	<input name="qst4" type="radio" value="2" /> 2-Too short<br />
	<input name="qst4" type="radio" value="3" /> 3-Reasoneble<br />
	<input name="qst4" type="radio" value="9" /> 9-No answer<br />

	</li>

	<li><strong>5 - Were the instructions for answering and completing the
	survey:</strong><br />
	<input name="qst5" type="radio" value="1" /> 1-Clear (skip to item 7)<br />
	<input name="qst5" type="radio" value="2" /> 2-Confusing (go to item 6)<br />
	<input name="qst5" type="radio" value="3" /> 3-No opinion (skip to item
	7)<br />
	<input name="qst5" type="radio" value="9" /> 9-No answer<br />

	</li>


	<li><strong>6 - Please describe how the instructions were confusing or
	what problems you had completing the questions. You can also write
	directly on survey to indicate any confusion/problems.</strong><br />
	<textarea name="qst6" style="width: 690px; height: 100px"></textarea></li>


	<li><strong>7 - Were there any questions or topics in the survey that
	were confusing to you?</strong><br />
	<input name="qst7" type="radio" value="1" /> 1-Yes (skip to item 8)<br />
	<input name="qst7" type="radio" value="2" /> 2-No (go to item 9)<br />
	<input name="qst7" type="radio" value="3" /> 3-Not sure<br />
	<input name="qst7" type="radio" value="9" /> 9-No answer<br />


	</li>

	<li><strong>8 - Briefly describe wich questions or topics were
	confusing (including questions numbers when applicable).</strong><br />
	<textarea name="qst8" style="width: 690px; height: 100px"></textarea></li>

	<li><strong>9 - <font color="#FF0000"> [For treatment director and
	staff versions only] </font> For the question about treatment practices
	at the end of the survey (Section X), were you able to answer each part
	(1-4) easily?</strong><br />
	<input name="qst9" type="radio" value="1" /> 1-Yes (go to item 10)<br />
	<input name="qst9" type="radio" value="2" /> 2-No (skip to item 11)<br />
	<input name="qst9" type="radio" value="3" /> 3-Not sure<br />
	<input name="qst9" type="radio" value="9" /> 9-No answer<br />
	</li>

	<li><strong>10 - Briefly describe what was confusing.</strong><br />
	<textarea name="qst10" style="width: 690px; height: 100px"></textarea>

	</li>

	<li><strong>11 - Where there any major topics not included in the
	survey that you think should have been?</strong><br />
	<input name="qst11" type="radio" value="1" /> 1-Yes (go to item 12)<br />
	<input name="qst11" type="radio" value="2" /> 2-No (skip to item 13)<br />
	<input name="qst11" type="radio" value="3" /> 3-Not sure<br />
	<input name="qst11" type="radio" value="9" /> 9-No answer<br />
	</li>

	<li><strong>12 - Briefly describe other key topics you think should
	have been included.</strong><br />
	<textarea name="qst12" style="width: 690px; height: 100px"></textarea>
	</li>



	<li><strong>13 - For the actual research study, we may ask staff
	members to complete the survey either at an <u>outside location</u>, or
	at their <u>own workplace</u>. Because of the nature of the survey
	(questions about work environment and supervisors), how would you feel
	about completing the survey:</strong><br />

	<br />
	<strong>A - At an outside location:</strong><br />

	<input name="qst13_A" type="radio" value="1" /> 1-Comfortable<br />
	<input name="qst13_A" type="radio" value="2" /> 2-Uncomfortable<br />
	<input name="qst13_A" type="radio" value="3" /> 3-Not sure<br />
	<input name="qst13_A" type="radio" value="9" /> 9-No answer<br />

	<br />
	<strong>B - At own workplace:</strong><br />

	<input name="qst13_B" type="radio" value="1" /> 1-Comfortable<br />
	<input name="qst13_B" type="radio" value="2" /> 2-Uncomfortable<br />
	<input name="qst13_B" type="radio" value="3" /> 3-Not sure<br />
	<input name="qst13_B" type="radio" value="9" /> 9-No answer<br />

	<br />
	<strong>C - In a room where others are completing the same survey:</strong><br />

	<input name="qst13_C" type="radio" value="1" /> 1-Comfortable<br />
	<input name="qst13_C" type="radio" value="2" /> 2-Uncomfortable<br />
	<input name="qst13_C" type="radio" value="3" /> 3-Not sure<br />
	<input name="qst13_C" type="radio" value="9" /> 9-No answer<br />

	</li>

	<li><strong>14 - Can we contact you to ask further questions regarding
	your opinions about the survey?</strong><br />
	<input name="qst14" type="radio" value="1" /> 1-Yes<br />
	<input name="qst14" type="radio" value="2" /> 2-No<br />
	<input name="qst14" type="radio" value="9" /> 9-No answer<br />

	<br />
	<strong>If yes, please write your name and a phone number and/or e-mail
	address at which you would like to be contacted. If you do not want to
	be contacted, you do not need to provide this information.</strong><br />

	<br />
	<strong>Name</strong> &nbsp;<input name="qst14_name" type="text"
		size="30" maxlength="50" /> &nbsp; <strong>Phone Number</strong> <input
		name="qst14_phone" type="text" size="15" maxlength="50" /> <br />
	<br />
	<strong>E-mail</strong> <input name="qst14_email" type="text" size="50"
		maxlength="50" /></li>

	<li><strong>15 - Would you be interested in participating in a focus
	group, either in person or by telephone, where we discuss your
	experiences with the survey? </strong><br />
	<input name="qst15" type="radio" value="1" /> 1-Yes<br />
	<input name="qst15" type="radio" value="2" /> 2-No<br />
	<input name="qst15" type="radio" value="9" /> 9-No answer<br />
	</li>



	<li style="text-align: center"><input type="submit" name="Submit"
		value="Submit" /> &nbsp; <input type="reset" name="Reset"
		value="Reset" /></li>

</ul>
</form>

</div>

<?php include "inc/footer.inc"; ?>

<script language="javascript">
function notImplemented()
{
	alert("This feature is not implemented yet!");
}
function checkFill()
{
	var form = document.getElementById('surveyform'); 
	
	/*
	var qstType = getRadioValue(form.qstType);
	var qst1 = getRadioValue(form.qst1);
	var qst2 = getRadioValue(form.qst2);
	var qst3 = getRadioValue(form.qst3);
	var qst4 = getRadioValue(form.qst4);
	var qst5 = getRadioValue(form.qst5);
	var qst7 = getRadioValue(form.qst7);
	var qst9 = getRadioValue(form.qst9);
	var qst11 = getRadioValue(form.qst11);
	var qst13_A = getRadioValue(form.qst13_A);
	var qst13_B = getRadioValue(form.qst13_B);
	var qst13_C = getRadioValue(form.qst13_C);
	var qst14 = getRadioValue(form.qst14);
	var qst15 = getRadioValue(form.qst15);
	*/
	
	var arrayFields = new Array();
	var i = 0;
		
	arrayFields[i++]="form.qstType";
	arrayFields[i++]="form.qst1";
	arrayFields[i++]="form.qst2";
	arrayFields[i++]="form.qst3";
	arrayFields[i++]="form.qst4";
	arrayFields[i++]="form.qst5";
	arrayFields[i++]="form.qst7";
	arrayFields[i++]="form.qst9";
	arrayFields[i++]="form.qst11";
	arrayFields[i++]="form.qst13_A";
	arrayFields[i++]="form.qst13_B";
	arrayFields[i++]="form.qst13_C";
	arrayFields[i++]="form.qst14";
	arrayFields[i++]="form.qst15";
	
	
	for(j=0;j<arrayFields.length;j++)
	{
		if(getRadioValue(eval(eval("arrayFields["+j+"]"))) == null)
		{
			alert(eval("arrayFields["+j+"]") + " is not checked!");
			//eval(eval("arrayFields["+j+"]") + ".focus();")
			return false;
		}
	}
}
</script>
